package org.tong;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tong.aspect.LogAspect;

import java.util.Date;

@SpringBootApplication
@PropertySource({"classpath:h2.properties"})
@RestController
@Api(value = "MiddlewareStartup")
@Slf4j
public class MiddlewareStartup {

    @RequestMapping("/")
    @ApiOperation("首页")
    @LogAspect
    public String index() {
        NumberFormatException error = new NumberFormatException("error");
        log.info("hahahah", error);
        return "welcome to middleware " + new Date();
    }


    public static void main(String[] args) {
        SpringApplication.run(MiddlewareStartup.class, args);
    }
}
